<template>
  <div :class="[`nav-theme-${navTheme}`, `mav-layout-${navLayout}`]">
    <a-layout id="components-layout-demo-custom-trigger">
      <a-layout-sider 
        v-if="navLayout == 'left'"
        :theme="navTheme" 
        v-model="collapsed" 
        :trigger="null" collapsible
        width="256px"
      >
        <div class="logo">Hey the logo</div>
        <SideMenu :theme="navTheme" />
      </a-layout-sider>
      <a-layout>
        <a-layout-header style="background: #fff; padding: 0">
          <Header @toggleSidebar="toggleSidebarCollapsed" />
        </a-layout-header>
        <a-layout-content
          :style="{ margin: '24px 16px', padding: '24px', background: '#fff', minHeight: '280px' }"
        >
          <router-view></router-view>
        </a-layout-content>
        <a-layout-footer style="text-align: center">
          <Footer />
        </a-layout-footer>
      </a-layout>
      <SettingDrawer />
    </a-layout>
  </div>
</template>
<script>
import Header from "./Header";
import Footer from "./Footer";
import SideMenu from "./SideMenu";

import SettingDrawer from "../components/SettingDraw";

export default {
  data() {
    return {
      collapsed: false
    };
  },

  computed: {
    navTheme() {
      return this.$route.query.navTheme || 'dark';
    },
    navLayout() {
      return this.$route.query.navLayout || 'left';
    },
  },

  methods: {
    toggleSidebarCollapsed(v) {
      console.log('Side bar collapsed in layout');
      this.collapsed = v;
    }
  },

  components: {
    Header,
    Footer,
    SideMenu,
    SettingDrawer,
  }
};
</script>
<style>
#components-layout-demo-custom-trigger .trigger {
  font-size: 18px;
  line-height: 64px;
  padding: 0 24px;
  cursor: pointer;
  transition: color 0.3s;
}

#components-layout-demo-custom-trigger .trigger:hover {
  color: #1890ff;
}

#components-layout-demo-custom-trigger .logo {
  height: 32px;
  background: rgba(255, 255, 255, 0.2);
  margin: 16px;
}

.ant-layout.ant-layout-has-sider {
  height: 100vh;
}

.trigger {
  padding: 0 20px;
  line-height: 64px;
  font-size: 20px;
}

.trigger:hover {
  background: #eeeeee;
}

.nav-theme-dark #components-layout-demo-custom-trigger .logo {
  color: #fff;
  background: transparent;
}
</style>
